home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 47.7z / BS1 part 47 / ImageMaster RT v1.50b (1994)(Black Belt Systems)(Disk 6 of 7)[HD].7z / ImageMaster RT v1.50b (1994)(Black Belt Systems)(Disk 6 of 7)[HD].adf / piarc.lzh.parta / NBook.rexx < prev    next >
OS/2 REXX Batch file  |  1994-03-17  |  4KB  |  123 lines

  1. /*
  2.  * NBook.rexx
  3.  *
  4.  *  Written by: Pete Patterson & Ben Williams
  5.  * Last Update: February 27th, 1993
  6.  *         For: Black Belt Systems Amiga image processing software "IM"
  7.  * --------------------------------------------------------------------
  8.  *    Revision: 2.00
  9.  */
  10.  
  11. parse arg fullname
  12.  
  13. if ~show('L',"rexxsupport.library") then do
  14.   if ~addlib('rexxsupport.library',0,-30,0) then do
  15.     say 'We Have A Library Problem, Unable To Load "rexxsupport.library"';
  16.     say 'Cannot operate PI Modules without this library - sorry!';
  17.     'finish';
  18.     exit 10;
  19.     end;
  20.   end;
  21.  
  22. prtnme = 'IP_Port'; /* assume Image Professional */
  23. if show('P','IP_Port') = 0 then do
  24.   if show('P','IM_Port') = 0 then do
  25.     say "Can't find image processor's ARexx port!!!"; /* not running? */
  26.     say "This script requires IP, IM or IM F/c to run!";
  27.     exit(20);
  28.     end;
  29.   else do
  30.     prtnme = 'IM_Port';
  31.     end;
  32.   end;
  33.  
  34. cmdpath = 'c:';
  35. if open(fhandle,'rexx:picmdpath','read') then
  36.   do
  37.     cmdpath = readln(fhandle);
  38.     call close(fhandle);
  39.   end
  40.  
  41. if fullname = "" then
  42.   do
  43.     options results;
  44.     address command 'rx rxpi:GetFile.rexx';
  45.     if open(fhandle,'ram:IP_FNAME.tmp','read') then
  46.       do
  47.         fullname = readln(fhandle);
  48.         call close(fhandle);
  49.       end
  50.   end
  51.  
  52. thispath = gimmepath(fullname);
  53.  
  54. /* --------------------------------------------------------------------- */
  55. /* ------------- BEGINNING of format-specific ARexx code --------------- */
  56. /* --------------------------------------------------------------------- */
  57.  
  58. address command cmdpath||'NBKRD c "'||fullname||'"';
  59. if rc ~= 0 then do; address(prtnme); 'message "Cannot read '||fullname||' Error = '||rc||'"'; 'finish'; exit 0; end;
  60. call open(fhandle,'ram:IP_LDNBK.tmp','read'); rstring = readln(fhandle); call close(fhandle);
  61. parse var rstring width '/' height
  62. address command 'c:delete >nil: ram:IP_LDNBK.tmp';
  63. if height < 0     then do; 'message "Bad Height:' height '"'; 'finish'; exit 0; end;
  64. if height > 32767 then do; 'message "Bad Height:' height '"'; 'finish'; exit 0; end;
  65. if width  < 0     then do; 'message "Bad Width:'  width  '"'; 'finish'; exit 0; end;
  66. if width  > 32767 then do; 'message "Bad Width:'  width  '"'; 'finish'; exit 0; end;
  67. address(prtnme);
  68. 'imtofront';
  69. 'autoredraw 0';
  70. options results;
  71. 'newtargetted '||width||' '||height||' "'||gxname||'"'
  72. if rc ~= 0 then do; 'options'; "message Can't allocate buffer!"; 'autoredraw 1'; 'finish'; exit 0; end;
  73. bnum = result;
  74. 'backin '||bnum;
  75. plugadr = result;
  76. options;
  77. 'lockimage '||bnum;
  78. address command cmdpath||'nbkrd d'||plugadr||' "'||fullname||'"';
  79. 'unlockimage '||bnum;
  80. 'imtofront';
  81. 'autoredraw 1';
  82. 'finish';
  83. exit 0;
  84.  
  85. /* --------------------------------------------------------------------- */
  86. /* ---------------- END of format-specific ARexx code ------------------ */
  87. /* --------------------------------------------------------------------- */
  88.  
  89. gimmepath:
  90.   arg fullnamegx;
  91.     tempgx = reverse(fullnamegx);
  92.     lengx = length(fullnamegx);   /* get length of string */
  93.     slashdex = index(tempgx,'/'); /* first occurance of '/' from right */
  94.     colondex = index(tempgx,':');  /* first occurance of ':' from right */
  95.     seploc = 0; /* assumes current dir, no path supplied */
  96.     if slashdex ~= 0 then do /* we assume we are in a DIR */
  97.       seploc = (lengx - slashdex)+1;
  98.       end;
  99.     else do
  100.       if colondex ~= 0 then do /* we assume we are on a device */
  101.         seploc = (lengx - colondex)+1;
  102.         end;
  103.       end;
  104.   gxname = substr(fullnamegx,seploc+1); /* if you ever need it */
  105.   gxpath = left(fullnamegx,seploc);
  106.   return(gxpath);
  107.  
  108. expandfilename:
  109.   parse arg jfile;
  110.   if index(jfile,':') = 0 then do
  111.     curdir = pragma(D);
  112.     if right(curdir,1) ~= ':' then do
  113.       if right(curdir,1) ~= '/' then do
  114.         if curdir ~= '' then do
  115.           curdir = curdir || '/';
  116.           end;
  117.         end;
  118.       end;
  119.     jfile = curdir||jfile;
  120.     end;
  121.   return(jfile);
  122. -----------------------------------------
  123.